<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>

    .box {
        width: 400px;
        height: 500px;
        background-color: lightgray;
        margin: auto;
        padding: 20px;
        box-sizing: border-box;
    }

    .inp {
        outline-style: none;
        border: 0;
        border-radius: 5px;
    }

    .input-control:placeholder-shown::placeholder { 
        color: transparent; 
    }

    .input-box{
        position: relative;
        margin-bottom: 20px;
    }
    .input-label {
        position: absolute;
        left: 10px; 
        top: 2px;
        pointer-events: none;
        color: lightgray;
    }

    .input-control:not(:placeholder-shown) ~ .input-label,
    .input-control:focus ~ .input-label {
        color: #2486ff;
        transform: scale(0.75) translate(-20px, -24px);
        transition: .7s;
    }

</style>

<body>
    <div class="box">
        <div class="input-box"> 
            <input class="inp input-control input-outline" placeholder="用户名">
            <label class="input-label">用户名</label>
        </div>
        <div class="input-box"> 
            <input class="inp input-control input-outline" placeholder="密码">
            <label class="input-label">密码</label>
        </div>
    </div>
</body>
</html>